import matplotlib.pyplot as plt
import numpy as np
from test0 import create_coordinate_system

# 创建一个坐标系
fig, ax = create_coordinate_system(x_range=(-5, 5), y_range=(-8, 8), figsize=(6, 8))

# 添加一个二次函数的图像
x = np.linspace(-1, 3, 100)
y = (x-1)**2 + 1 

# 关于X轴对称，-((x-1)**2 + 1) = -(x-1)**2 - 1
x1 = np.linspace(-1, 3, 100)
y1 = -(x1-1)**2 - 1

# 绘制二次函数的图像
ax.plot(x, y, 'r-', linewidth=2, label='y = f(x)', color='black')
ax.plot(x1, y1, 'r-', linewidth=2, label='y = -f(x)', color='red')

ax.legend()
plt.show()
